home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 April
/
EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso
/
Recent1
/
DiskMaster21d.lha
/
DiskMasterII
/
rexx
/
Sub_FileRecog.REXX
< prev
Wrap
OS/2 REXX Batch file
|
1997-01-07
|
3KB
|
140 lines
/*
** $VER: FileRecog subroutine v2.8 (07.01.97) (c) Inorix scripts
**
** FR_T clip : Filetype
** FR_S clip : Short type identifier
** FR_I clip : first 48 chars as hex string
**
***************************************************************************
** Known filetypes:
** ----------------
** Archives: LZH,LHA,LHA-SFX,LZX,ZIP,ARC,RAR,ARJ,DMS,Zoom,XMash,XArchive,
** PackDev.
** Packed : XPK,PP20.
** Images : GIF,JPEG,IFF,ANIM.
** Sound : WAVE,8SVX.
** Other : EXE,ICON,GUIDE,IntroCAD.
** IFF : ILBM,ANIM,8SVX,CTLG,PREF,CDAF,FAXX,STFax.
\*************************************************************************/
OPTIONS RESULTS
PARSE ARG filename
CALL OPEN(file,filename,R)
dump=READCH(file,48)
CALL CLOSE(file)
dump2=C2X(dump)
SELECT
WHEN LEFT(dump2,8)='504B0304' THEN DO
ftype='Archive'
short='ZIP'
END
WHEN SUBSTR(dump2,5,10)='2D6C68352D' THEN DO
ftype='Archive'
short='LHA'
END
WHEN SUBSTR(dump2,5,10)='2D6C68312D' THEN DO
ftype='Archive'
short='LZH'
END
WHEN LEFT(dump2,4)='1A08' THEN DO
ftype='Archive'
short='ARC'
END
WHEN LEFT(dump2,4)='60EA' THEN DO
ftype='Archive'
short='ARJ'
END
WHEN LEFT(dump2,8)='4C5A5800' THEN DO
ftype='Archive'
short='LZX'
END
WHEN LEFT(dump2,8)='444D5321' THEN DO
ftype='DiskArchive'
short='DMS'
END
WHEN LEFT(dump2,8)='504B4413' THEN DO
ftype='DiskArchive'
packtype=SUBSTR(dump,25,4)
IF packtype=NULL() THEN packtype='NONE'
short='PKD-'packtype
END
WHEN LEFT(dump2,10)='4D53484400' THEN DO
ftype='DiskArchive'
short='XMS'
END
WHEN LEFT(dump2,8)='5A4F4D35' THEN DO
ftype='DiskArchive'
short='ZOOM'
END
WHEN LEFT(dump2,8)='52617221' THEN DO
ftype='Archive'
short='RAR'
END
WHEN LEFT(dump2,8)='58504B46' THEN DO
ftype='Packed data'
short='XPK-'SUBSTR(dump,9,4)
END
WHEN LEFT(dump2,8)='50503230' THEN DO
ftype='Packed data'
short='PP20'
END
WHEN LEFT(dump2,10)='000003F300' THEN DO
ftype='Executable'
short='EXE'
IF RIGHT(dump,4)='SFX!' THEN DO
ftype='Archive'
short='SFX'
END
END
WHEN LEFT(dump2,10)='E310000100' THEN DO
ftype='Icon'
short='ICON'
END
WHEN LEFT(dump2,12)='474946383761' THEN DO
ftype='Picture'
short='GIF'
END
WHEN LEFT(dump2,8)='FFD8FFE0' THEN DO
ftype='Picture'
short='JPG'
END
WHEN UPPER(LEFT(dump,9))='@DATABASE' THEN DO
ftype='AmigaGuide'
short='GUIDE'
END
WHEN LEFT(dump2,8)='464F524D' THEN DO
ftype='IFF'
short='IFF-'SUBSTR(dump,9,4)
IF RIGHT(short,4)='8SVX' THEN ftype='Sound'
IF RIGHT(short,4)='ILBM' THEN ftype='Picture'
IF RIGHT(short,4)='CTLG' THEN ftype='Catalog'
IF RIGHT(short,4)='PREF' THEN ftype='Preferences'
IF RIGHT(short,4)='ANIM' THEN ftype='Animation'
IF RIGHT(short,4)='FAXX' THEN ftype='Fax'
IF RIGHT(short,4)='STFX' THEN ftype='STFax'
IF RIGHT(short,4)='CDAF' THEN DO
ftype='Archive'
short='XAR'
END
END
WHEN (LEFT(dump2,8)='52494646')&(SUBSTR(dump2,17,8)='57415645') THEN DO
ftype='Sound'
short='WAVE'
END
WHEN LEFT(DUMP2,8)='0012D644' THEN DO
ftype='IntroCAD'
short='CAD'
END
OTHERWISE DO
ftype='Unsupported'
short='???'
END
END
SETCLIP(FR_T,ftype)
SETCLIP(FR_S,short)
SETCLIP(FR_I,dump2)
RETURN